//
//  InformationTableOneCell.m
//  meiyinxiang
//
//  Created by lizidi on 2018/1/11.
//  Copyright © 2018年 hbjApple. All rights reserved.
//

#import "InformationTableOneCell.h"
@interface InformationTableOneCell()
@property(nonatomic,strong)UILabel * labelone,*detialLabel,*timeLabel;
@property(nonatomic,strong)UIImageView * detialImg;


@end;

@implementation InformationTableOneCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        if (!_labelone) {
            _labelone = [[UILabel alloc] init];
            _labelone.text = @"发布";
            _labelone.font = [MyAdapter lfontADapter:15];
            [self addSubview:_labelone];
            [_labelone mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.offset([MyAdapter laDapter:20]);
                make.centerY.equalTo(self.contentView.mas_centerY);
                make.height.offset([MyAdapter laDapter:20]);
                make.width.offset([MyAdapter laDapter:40]);
            }];
        }
        if (!_detialImg) {
            _detialImg = [[UIImageView alloc]init];
            _detialImg.image = [UIImage imageNamed:@"cardpanl"];
            [self addSubview:_detialImg];
            [_detialImg mas_makeConstraints:^(MASConstraintMaker *make) {
                make.centerY.equalTo(self.contentView.mas_centerY);
                make.height.width.offset([MyAdapter laDapter:70]);
                make.left.equalTo(_labelone.mas_right).offset([MyAdapter laDapter:28]);
            }];
        }
        if (!_detialLabel) {
            _detialLabel =[[UILabel alloc]init];
            _detialLabel.textColor = RGBACOLOR(29, 29, 29, 1);
            _detialLabel.text = @"实打实的撒大大声撒旦撒旦撒";
            _detialLabel.font = [MyAdapter lfontADapter:15];
            _detialLabel.numberOfLines = 1;
            _detialLabel.textAlignment = 0;
            [self addSubview:_detialLabel];
            [_detialLabel mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(_detialImg.mas_right).offset([MyAdapter laDapter:10]);
                make.top.equalTo(_detialImg.mas_top);
                make.right.offset([MyAdapter laDapter:-15]);
                make.height.offset([MyAdapter laDapter:30]);
            }];
        }
        if (!_timeLabel) {
            _timeLabel =[[UILabel alloc]init];
            _timeLabel.textColor = RGBACOLOR(29, 29, 29, 1);
            _timeLabel.font = [MyAdapter lfontADapter:12];
            _timeLabel.text = @"2018-1-3";
            _timeLabel.numberOfLines = 1;
            _timeLabel.textAlignment = 0;
            [self addSubview:_timeLabel];
            [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(_detialImg.mas_right).offset([MyAdapter laDapter:10]);
                make.bottom.equalTo(_detialImg.mas_bottom);
                make.height.offset([MyAdapter laDapter:15]);
            }];
        }
        
        
    }
    
    
    return self;
}
-(void)setMYXotherinfoListModel:(MYXotherinfoListModel *)MYXotherinfoListModel
{
   // [self.detialImg sd_setImageWithURL:[NSURL URLWithString:MYXotherinfoListModel.file]];
    NSArray *urlArray = [MYXotherinfoListModel.file componentsSeparatedByString:@","];
    NSString *imgurl = urlArray[0];
    [self.detialImg sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",MYXIMGBaseUrl,imgurl]] placeholderImage:[UIImage imageNamed:@"defual_luckyImg"]];
    self.detialImg.contentMode  = UIViewContentModeScaleAspectFill;
    self.detialImg.layer.masksToBounds = YES;
    self.detialLabel.text = MYXotherinfoListModel.content;
    
//    NSDateFormatter *formatter =[[NSDateFormatter alloc] init];
//    [formatter setDateStyle:NSDateFormatterMediumStyle];
//    [formatter setTimeStyle:NSDateFormatterShortStyle];
//    [formatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"]; // ----------设置你想要的格式,hh与      HH的区别:分别表示12小时制,24小时制
//    NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Shanghai"];
//    [formatter setTimeZone:timeZone];
//    NSDate* date = [formatter dateFromString:MYXotherinfoListModel.create_time];
//    NSString *timeStr= [MYXDateTimeHelper prettyDateWithRefe:date];

    
    self.timeLabel.text = [MYXDateTimeHelper birthDayTimeWithIntervalString:MYXotherinfoListModel.create_time];
}



- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
